Version SQL migration files in source control using golang-migrate or goose, run migrations as a CI step against a test database, and deploy destructive changes with multi-phase migrations.
CI: run migrations against a fresh test DB, run integration tests, then merge
Production: run migrations as a Kubernetes Job or init container before rolling deployment
Backward-compatible migrations: add columns as nullable first, backfill, then add NOT NULL constraint
Never DROP COLUMN in the same deployment that removes the code referencing it — two-phase deploy
Use advisory locks (SELECT pg_advisory_lock) to prevent concurrent migration runs
We have a Go microservice that uses PostgreSQL. How would you add a new column to an existing table as part of a CI pipeline without breaking the current deployment?
If a migration script fails during the CI run, what steps would you take to ensure the pipeline reports the failure and the database is left in a consistent state?
During a release we noticed that a recent migration caused a runtime panic in our Go service. Walk me through how you would investigate and fix the issue.
Explain the pros and cons of using a tool like golang-migrate versus embedding raw SQL files in your repository for managing migrations in CI/CD.
Our service runs zero‑downtime deployments across multiple regions. How would you design the migration strategy in the CI/CD pipeline to guarantee no downtime and handle rollbacks if something goes wrong?
What considerations would you make for handling large data backfills in migrations to avoid performance impact on production, especially when the CI pipeline triggers them automatically?
We have several Go services sharing a monolithic database, each with its own CI pipeline. How would you coordinate schema migrations across services to avoid coupling and ensure safe, incremental releases?
Describe a long‑term strategy for evolving the database schema in a microservices architecture where some services will eventually own their own databases, and how CI/CD pipelines should adapt during that transition.